package com.java.demo.service;

import com.java.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class UserService2 {

    // 属性注入
    @Resource(name = "user2")
    private final User user;

    public UserService2(){
        this.user = null;
    }

    public void sayHi(){
        System.out.println(user.toString());
    }

}
